package io.bear.common.exception;


import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 校验异常
 * <p>
 * 适用场景：
 * <p>
 * 1、Validate 校验不通过时
 * <p>
 * 2、Assert 断言不满足继续执行下去的条件时
 * <p>
 * 3、其它 由于不满足条件而无法继续执行的场景。
 */
@Data
public class ValidatorException extends RuntimeException {
    @ApiModelProperty(value = "响应编码")
    protected Integer code = 500;

    public ValidatorException() {
    }

    public ValidatorException(String message) {
        super(message);
    }

    public ValidatorException(String message, Throwable cause) {
        super(message, cause);
    }

    public ValidatorException(Throwable cause) {
        super(cause);
    }

    public ValidatorException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public ValidatorException(Integer code) {
        this.code = code;
    }

    public ValidatorException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    public ValidatorException(String message, Throwable cause, Integer code) {
        super(message, cause);
        this.code = code;
    }

    public ValidatorException(Throwable cause, Integer code) {
        super(cause);
        this.code = code;
    }

    public ValidatorException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Integer code) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.code = code;
    }
}
